<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script type="text/javascript">
    function PointInPoly(pt, poly) {
        for (var c = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i)
            ((poly[i].lng <= pt.lng && pt.lng < poly[j].lng) || (poly[j].lng <= pt.lng && pt.lng < poly[i].lng))
            && (pt.lat < (poly[j].lat - poly[i].lat) * (pt.lng - poly[i].lng) / (poly[j].lng - poly[i].lng) + poly[i].lat)
            && (c = !c);
        return c;
    }
    var pt = {lat:31.16552,lng:104.39097};
    var list = [{lat:31.231298103688736,lng:104.30342674255371},{lat:31.26534594881066,lng:104.51079368591309},{lat:30.910472767872786,lng:104.43431854248047},{lat:30.95641324406724,lng:103.92757415771484},{lat:31.31962097800167,lng:104.15416717529297}];
    console.log(PointInPoly(pt,list));
</script>
</body>
</html>